package com.chancingpack.controller;

import com.alibaba.fastjson.JSONObject;
import com.chancingpack.service.WxForselectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2017/7/21.
 */
@Controller
@RequestMapping("/WxForselectController")
public class WxForselectController {
    @Autowired private WxForselectService wxForselectService;

    @RequestMapping("/getList")
    public ModelAndView getList(){
        ModelAndView view=new ModelAndView("/order/orderList");
        List<Map<String, Object>> sgbasCustInfoMap=wxForselectService.selectMap(null);
        view.addObject("sgbasCustInfoMap", sgbasCustInfoMap);
        return view;
    }

    //测试
    @RequestMapping("/test")
    public ModelAndView test(HttpServletRequest request){
        ModelAndView view=new ModelAndView("/order/orderList");
        String consiId=(String)request.getSession().getAttribute("consiId");
        List<Map<String, Object>> orderMap=wxForselectService.selectMapByCustId(consiId);
        view.addObject("orderMap", JSONObject.toJSONString(orderMap));
        return view;
    }


    @RequestMapping("/getLists")
    public ModelAndView getLists(/*@RequestParam(value = "pageSize") Integer pageSize,@RequestParam(value = "pageStart") Integer pageStart*/){
        ModelAndView view=new ModelAndView("/order/orderList");
        List<Map<String, Object>> orderMap=wxForselectService.selectMapPage(30,0);
        view.addObject("orderMap", orderMap);
        return view;
    }
}
